import BuffUtil from '@/BuffUtil';
import BuffCommon from 'code/Core/Common/BuffCommon';
import UnitCommon from 'code/Core/Common/UnitCommon';
import AbilityBase from 'code/Scripts/Abilities/base/AbilityBase';
/**
 * 寒冰壁垒
 **/
export default class FS_IceBarrior extends AbilityBase {
    static instance: FS_IceBarrior;
    buffType: AppBuffType = {
        id: 'buff_FS_IceBarrior',
        art: this.art,
        name: this.abilityName,
        ubertip: '护甲与生命回复速度提升',
        dur: 30,
        targetAttach: 'chest',
        targetArt: 'Abilities\\Spells\\Undead\\FrostArmor\\FrostArmorTarget.mdl',
        attribute: {},
    };
    constructor(id: string) {
        super(id);
        FS_IceBarrior.instance = this;
        this.init();
        se.onUnitSpellEffect(this.onSpellEffect.bind(this), this.id);
    }
    init() {
        BuffUtil.registerBuffType(this.buffType);
    }
    cast<T extends Object = any>(tarX: number, tarY: number, source: unit, target: unit, data?: T): void {
        let lv = this.getAbilityLevel(source);
        let inte = UnitCommon.取总精神(source);
        BuffCommon.addBuff({
            target: target,
            caster: source,
            buffTypeId: this.buffType.id,
            ablityId: this.id,
            attribute: {
                附加护甲: (20 + UnitCommon.取法强(source) * 0.5) * lv,
                生命恢复: 2 * lv + inte / 3,
            },
        });
    }
    onSpellEffect() {
        this.cast(GetSpellTargetX(), GetSpellTargetY(), GetTriggerUnit(), GetSpellTargetUnit());
    }
}
